function $(id) {
    return document.getElementById(id).value
}
// 用户名

function userName() {
    var name = $('name')
    var reg = /^.{2,13}$/
    var userTip = document.getElementById('user_tip')
    
    if (reg.test(name)) {
        localStorage.setItem('name', name)
        userTip.innerHTML = ""
        return true
    
    }
    userTip.innerHTML = '用户名与要求不符'
        return false
    
}

//手机号


function userIpone() {
    var sjh = $('sjh')
    var reg = /^1[0-9]{10}$/
    var iponeTip = document.getElementById('ipone_tip')
    iponeTip.innerHTML = ''
    if (!reg.test(sjh)) {
        iponeTip.innerHTML = '手机号与要求不符'
        return false
   
       
    }
    iponeTip.innerHTML = ""
    localStorage.setItem('sjh', sjh)
    return true
    
}


//邮箱

function userEmail() {
    var yx = $('yx')
    var reg = /^\w+@\w+\.\w+[(com)||(cn)]$/
    var emailTip = document.getElementById('email_tip')
    
    if (!reg.test(yx)) {
        emailTip.innerHTML = '邮箱与要求不符'
        return false
    
        
    }
    emailTip.innerHTML = ""
        localStorage.setItem('yx', yx)
    return true
    
}

//密码
function passwordName() {
    var pwd = $('pwd')
    var reg = /^.{4,12}$/
    var pwdTip = document.getElementById('pwd_tip')
  
    if (!reg.test(pwd)) {
        pwdTip.innerHTML = '密码与要求不符'
        return false
    }
    pwdTip.innerHTML = ""
    
        localStorage.setItem('pwd', pwd)
        return true
     
}

//确认密码
function passwordreName() {
    var repwd = $('repwd')
    var pwd= $('pwd')
    var pwdRe = document.getElementById('pwdRe_tip')
   
    if (repwd != pwd) {
        pwdRe.innerHTML = '两次密码不一致'
        return false
    }else{
        pwdRe.innerHTML = ""
        return true
    }
   
}





function checkAll() {
    return passwordName() && userIpone() && userName() && passwordreName() && userEmail()

}
